<%@ page import="java.util.ArrayList" %>
<%@ page import="zqdb.T_TWO" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <title></title>
</head>
<body>
<article class="page-container" style="padding-left: 0;">
    <form action="" method="post" class="form form-horizontal" id="form-admin-role-add" style="padding-top: 0">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <label for="roleName"></label><input class="input-text" id="roleName" name="roleName" type="text"
                                                     value="${list1[0].VALUE02}" readonly="readonly">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">角色信息：</label>
            <div class="formControls col-xs-8 col-sm-9" id="maininfo">
                ${nav}
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="button" class="btn btn-success radius" onclick="f_doo()"><i class="icon-ok"></i>确定
                </button>
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    function f_doo() {
        let str = "";
        let len =;          //--从后台返回的数组的长度回传给数据库
        let ls_roleid =;    //--从后台得到的角色编号

        <%
           ArrayList list = (ArrayList) request.getAttribute("list2");
           for(int i = 0; i < list.size(); i++) {
               T_TWO two = (T_TWO) list.get(i);
        %>
        const msg = '<%=two.getVALUE01()%>';
        str += msg + "$";

        const ls_con = "#item" + msg;
        const btn = $("#maininfo").find(ls_con);
        const ls_bcode = btn.is(":checked");
        str += ls_bcode.toString() + "$|";
        <%
            }
         %>

        let ls_opid = "${sessionOpid}";
        $.ajax({                            //该方法提交，在前端获取控件的值去进行提交， 两种方法就是前段和后端的区别
            type: 'post',
            url: "com",
            data: {
                URL: '',
                CMD: 'ZE',
                VALUE01: ls_roleid,
                VALUE02: len,
                VALUE03: str,
                VALUE04: ls_opid,
            },
            async: false,
            success: function (data) {
                var jsonobj = JSON.parse(data);
                var json1 = jsonobj.db1;
                if (json1[0].VALUE01.toString() === 'ZZ00') {
                    layer.msg('数据库操作完毕!', {icon: 1, time: 1500}, function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                } else {
                    layer.msg(json1[0].VALUE02.toString(), {icon: 2, time: 2000, area: ['200px', '65px']}, function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                layer.msg('网络异常错误', {icon: 1, time: 1000});
            }
        });
    }

    $(function () {
        $(".permission-list dt input:checkbox").click(function () {
            $(this).closest("dl").find("dd input:checkbox").prop("checked", $(this).prop("checked"));
        });
        $(".permission-list dd input:checkbox").click(function () {
            var l = $(this).parent().parent().find("input:checked").length;
            if ($(this).prop("checked")) {
                $(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked", true);
            } else {
                if (l === 0) {
                    $(this).closest("dl").find("dt input:checkbox").prop("checked", false);
                }
            }
        });
    });

    $(document).ajaxComplete(function (event, xhr, settings) {
        //从http头信息取出 在filter定义的sessionstatus，判断是否是 timeout
        if (xhr.getResponseHeader("sessionstatus") === "timeout") {
            //从http头信息取出登录的url ＝ loginPath
            if (xhr.getResponseHeader("loginPath")) {
                window.location.replace(xhr.getResponseHeader("loginPath"));
            }
        }
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
